/**
 * 2014-4-5 下午6:27:44
 * IndUX
 */
package com.indux.prefset.util;

import java.util.Collection;

/**
 * @author IndUX
 *
 */
public final class StringUtil
{
	public static boolean isEmpty(String string)
	{
		if (string == null || string.isEmpty() || string.trim().isEmpty())
		{
			return true;
		}
		return false;
	}
	
	public static boolean isNotEmpty(String string)
	{
		return !isEmpty(string);
	}
	
	public static <T> String join(Collection<T> collection, String sepStr)
	{
		if (collection.size() <= 0)
		{
			return null;
		}
		
		StringBuilder sb = new StringBuilder();
		for (T t : collection)
		{
			sb.append(t.toString()).append(sepStr);
		}
		
		sb.replace(sb.length() - sepStr.length(), sb.length(), "");
		
		return sb.toString();
	}
	
}
